<template>
	<el-container>
		<el-aside>
		</el-aside>
		<el-container>
			<el-main class="nopadding">
				<el-card shadow="hover" header="基础功能模块初始化">
					<div class="welcome">
						<div class="tips">
							<div class="tips-item">
								<div class="tips-item-icon"><el-icon><el-icon-menu/></el-icon></div>
								<div class="tips-item-message">
									请在系统管理员账号下操作，本次初始化为数据物理删除，不可找回。在初始化时需事先输入系统安全码！安全码在系统的全局配置文件中。也可向开发厂商咨询！</div>
							</div>
							<div class="tips-item">
								<div class="tips-item-icon" style="color: red;"><el-icon><sc-icon-info/></el-icon></div>
								<div class="tips-item-message" style="color: red;">注：点击初始化后，系统后面会自动清除除“BPM流程，收发文，智能业务平台，人员组织机构”以外的表数据。请谨慎操作！</div>
							</div>
						</div>
						<div class="actions">
							<el-button type="primary" icon="el-icon-check" size="large" @click="clearFunction">初始化</el-button>
						</div>
					</div>
				</el-card>
			</el-main>
		</el-container>
		<el-aside>
		</el-aside>
	</el-container>
</template>

<script>
export default {
	name: 'Initialization',
	data() {
		return {

		}
	},
	methods:{
		clearFunction()
		{
			this.$prompt('请输入系统安全码', "提示", {
				inputPlaceholder:'请输入系统安全码',
				confirmButtonText: "确定",
				closeOnClickModal: false,
				type: "warning",
				inputValidator: (value)=>{if(value==""){return false;}},
			}).then(async (e) => {
				var res = await this.$API.system.initialization.doInitialization.post({userSignCode:e.value});
				if (res.code == 200) {
					this.$message.success(res.message)
				} else {
					this.$alert(res.message, "提示", {type: 'error'})
				}
			}).catch(() => {
				this.$message({type: 'info',message: '输入错误或已取消'});
			})
		}
	}
}
</script>

<style scoped>
.welcome {}
.tips {margin-top: 20px;padding:0 40px;}
.tips-item {display: flex;align-items: center;justify-content: center;padding:7.5px 0;}
.tips-item-icon {width: 40px;height:40px;display: flex;align-items: center;justify-content: center;border-radius: 50%;font-size: 18px;margin-right: 20px;color: var(--el-color-primary);background: rgba(180,180,180,0.1);}
.tips-item-message {flex: 1;font-size: 14px;}

.actions {text-align: center;margin: 40px 0 20px 0;}
</style>
